package cn.tedu.project.oa.attendanceRule.service.impl;

import cn.tedu.project.oa.attendanceRule.mapper.ReplenishRuleMapper;
import cn.tedu.project.oa.attendanceRule.pojo.entity.ReplenishRule;
import cn.tedu.project.oa.attendanceRule.service.IReplenishRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ReplenishRuleServiceImpl implements IReplenishRuleService {
    @Autowired
    private ReplenishRuleMapper replenishRuleMapper;

    /**
     * 查询补卡规则
     *
     * @param id 补卡规则主键
     * @return 补卡规则
     */
    @Override
    public ReplenishRule selectReplenishRuleById(Long id)
    {
        return replenishRuleMapper.selectReplenishRuleById(id);
    }

    /**
     * 查询补卡规则列表
     *
     * @param replenishRule 补卡规则
     * @return 补卡规则
     */
    @Override
    public List<ReplenishRule> selectReplenishRuleList(ReplenishRule replenishRule)
    {
        return replenishRuleMapper.selectReplenishRuleList(replenishRule);
    }

    /**
     * 新增补卡规则
     *
     * @param replenishRule 补卡规则
     * @return 结果
     */
    @Override
    public int insertReplenishRule(ReplenishRule replenishRule)
    {
        replenishRule.setCreateTime(new Date());
        return replenishRuleMapper.insertReplenishRule(replenishRule);
    }

    /**
     * 修改补卡规则
     *
     * @param replenishRule 补卡规则
     * @return 结果
     */
    @Override
    public int updateReplenishRule(ReplenishRule replenishRule)
    {
        replenishRule.setUpdateTime(new Date());
        return replenishRuleMapper.updateReplenishRule(replenishRule);
    }

    /**
     * 批量删除补卡规则
     *
     * @param ids 需要删除的补卡规则主键
     * @return 结果
     */
    @Override
    public int deleteReplenishRuleByIds(Long[] ids)
    {
        return replenishRuleMapper.deleteReplenishRuleByIds(ids);
    }

    /**
     * 删除补卡规则信息
     *
     * @param id 补卡规则主键
     * @return 结果
     */
    @Override
    public int deleteReplenishRuleById(Long id)
    {
        return replenishRuleMapper.deleteReplenishRuleById(id);
    }
}
